//
//  MyMenuTableViewController.m
//  MKUITestApp
//
//  Created by 苏尚进 on 2020/9/9.
//  Copyright © 2020 moon. All rights reserved.
//

#import "MyMenuTableViewController.h"
#import "MyMenuInfo.h"
#import "MyHistMenuTableViewCell.h"
#import "MyTabInfoTableViewCell.h"
#import "MyHistMenuTableViewCell2.h"
#import "MyHistMenuTableViewCell_fix.h"
@interface MyMenuTableViewController ()

@end

@implementation MyMenuTableViewController
+ (MKTFuncItem *)funcItem{
    return [MKTFuncItem funcWithName:@"我的菜单" viewControllerClass:self];
}
- (void)viewDidLoad{
    [super viewDidLoad];
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    self.tableView.backgroundColor = [UIColor lightGrayColor];
    UIBarButtonItem *refreshItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:(UIBarButtonSystemItemRefresh) target:self action:@selector(__refresh)];
    self.navigationItem.rightBarButtonItems = @[refreshItem];
    [self __reloadData];
}
- (void)__refresh{
    [self.model reloadTableViewData];
}
- (void)__reloadData{
    self.model.reuseCell = NO;
    [self.model removeAllSectionModels];
    MyMenuInfo *info = [[MyMenuInfo alloc] init];
    info.histMenus = [Menu sharedMenus];
    {
        [self.model addCellModel:[MKUITableViewCellModel modelWithValue:info cellClass:[MyHistMenuTableViewCell class]]];
    }
//    {
//        MyMenuInfoTableViewCellModel *cm = [[MyMenuInfoTableViewCellModel alloc] initWithModelObject:info];
//        cm.cellClass = [MyHistMenuTableViewCell class];
//        [self.model addCellModel:cm];
//    }
    {
        [self.model addCellModel:[MKUITableViewCellModel modelWithValue:info cellClass:[MyTabInfoTableViewCell class]]];
    }
    {
        [self.model addCellModel:[MKUITableViewCellModel modelWithValue:info cellClass:[MyHistMenuTableViewCell class]]];
    }
    {
        [self.model addCellModel:[MKUITableViewCellModel modelWithValue:info cellClass:[MyHistMenuTableViewCell2 class]]];
    }
    {
        [self.model addCellModel:[MKUITableViewCellModel modelWithValue:info cellClass:[MyHistMenuTableViewCell_fix class]]];
    }
    {
        [self.model addCellModel:[MKUITableViewCellModel modelWithValue:info cellClass:[MyHistMenuTableViewCell_fix_h class]]];
    }
    
    
    [self.model reloadTableViewData];
}
@end
